<?php
class user{
	public function Insert($user)
	{
		$ci =& get_instance();
		
		$ci->db->insert("user", $user);
	}
	
	public function GetAll()
	{
		$ci =& get_instance();
		
		$query = $ci->db->get("user");
		
		return $query->result();
	}
	
	public function GetByEmail($email)
	{
		$ci =& get_instance();
		
		$query = $ci->db->get_where('user', array('email' => $email));
		
		$res = $query->result();
		$res = $res[0];
		
		return $res;
	}
	
	public function GetById($id)
	{
		$ci =& get_instance();
		
		$query = $ci->db->get_where('user', array('id' => $id));
		
		$res = $query->result();
		$res = $res[0];
		
		return $res;
	}
	
	function DeleteByEmail($email)
	{
		$ci =& get_instance();
		
		$ci->db->delete('user', array('email' => $email));
	}
}
?>